package com.lingxu.config;

import com.lingxu.base.system.dict.service.SystemDictService;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Title: CacheConfig
 * @Package: com.lingxu.base.config
 * @Author: ysj闫世杰
 * @Email: 1105324813@qq.com
 * @Date: Created in 2021/9/2 10:34
 * @Description: 加载字典缓存数据
 * @Version: 1.0.0
 */
@Component
@Order(value = 1)   //设定执行顺序
public class CacheConfig implements ApplicationRunner {
    @Resource
    private SystemDictService systemDictService;
    @Override
    public void run(ApplicationArguments args) throws Exception {
        //获取开始时间
        long startTime=System.currentTimeMillis();
        //字典缓存
        systemDictService.findSystemDictCache("SJMFSysDict");
        //获取结束时间
        long endTime=System.currentTimeMillis();
        System.out.println(">>>>>>>>>>>>>>>>>>>>加载字典缓存成功<<<<<<<<<<<<<<<<<<<<<,共计耗时：" + (endTime - startTime) + "ms");
    }
}
